/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hieu.sms.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 
 * @author do_th
 */
@Entity
@Table(name = "department")
@NamedQueries({
		@NamedQuery(name = "Department.findAll", query = "SELECT d FROM Department d"),
		@NamedQuery(name = "Department.findById", query = "SELECT d FROM Department d WHERE d.id = :id"),
		@NamedQuery(name = "Department.findByDepId", query = "SELECT d FROM Department d WHERE d.depId = :depId"),
		@NamedQuery(name = "Department.findByName", query = "SELECT d FROM Department d WHERE d.name = :name") })
public class Department extends AbstractPersistentEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name = "id", updatable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "DepartmentSequence")
	@SequenceGenerator(name = "DepartmentSequence", sequenceName = "seq_department", allocationSize = 1)
	private Long id;
	@Basic(optional = false)
	@Column(name = "dep_id")
	private String depId;
	@Column(name = "name")
	private String name;

	public Department() {
	}

	public Department(Long id) {
		this.id = id;
	}

	public Department(Long id, String depId) {
		this.id = id;
		this.depId = depId;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDepId() {
		return depId;
	}

	public void setDepId(String depId) {
		this.depId = depId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Department)) {
			return false;
		}
		Department other = (Department) object;
		if ((this.id == null && other.id != null)
				|| (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "com.hieu.sms.model.Department[ id=" + id + " ]";
	}

}
